﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data;
using TERP.WaterClient.DbServices;
using TERP.WaterClient.Entities.Booking;
using TERP.WaterClient.Common;

namespace TERP.WaterClient.Entities.Booking
{
	public class SerCustomerCollection:List<SerCustomer>
	{
        private DataTable _dtbData;

        public SerCustomerCollection()
            : base()
        {

		}

        public DataTable DataTableCustomer
        {
            get { return _dtbData; }
            set { _dtbData = value; }
        }

        public SerCustomer FindCustomerByCusID(string CusID)
        {
            foreach (SerCustomer cus in this)
            {
                if (cus.CusID.Equals(CusID))
                    return cus;
            }
            return null;
        }

        public SerCustomer FindCustomerByPlateNo(string strPalteNo)
        {
            foreach (SerCustomer cus in this)
            {
                if (cus.PlateNo.Equals(strPalteNo))
                    return cus;
            }
            return null;
        }       

		/// <summary>
		/// 
		/// </summary>
		public void ClearData(){
			this.Clear();
			_dtbData = null;
		}

		/// <summary>
		/// 
		/// </summary>
		public DataView DataViewModel
		{
			get {
				DataView dv = new DataView(_dtbData);
				return dv; 
			}
		}
	}
}
